package com.github.hanlyjiang.androidtemplate.greendao;

import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.NotNull;
import org.greenrobot.greendao.annotation.Property;

/**
 * Created by jianghanghang on 2016/10/20.
 */
@Entity(
        // 表名
        nameInDb = "T_CATEGORY_INFO",
        // 是否创建表，一个表中映射了多个实体或者表在外部创建时应关闭
        createInDb = false,
        generateConstructors = true,
        generateGettersSetters = true
)
public class Category {

    /**
     * 唯一id
     */
    @Id(autoincrement = true)
    @Property(nameInDb = "id")
    private long id;

    /**
     * 分类代码，使用12为表示6个分类级别
     */
    @NotNull
    private String code;

    /**
     * 父级分类代码
     */
    @NotNull
    private String parentCode;

    /**
     * 分类级别
     */
    @NotNull
    private int level;

    @Generated(hash = 668892397)
    public Category(long id, @NotNull String code, @NotNull String parentCode,
                    int level) {
        this.id = id;
        this.code = code;
        this.parentCode = parentCode;
        this.level = level;
    }

    @Generated(hash = 1150634039)
    public Category() {
    }

    public long getId() {
        return this.id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getCode() {
        return this.code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getParentCode() {
        return this.parentCode;
    }

    public void setParentCode(String parentCode) {
        this.parentCode = parentCode;
    }

    public int getLevel() {
        return this.level;
    }

    public void setLevel(int level) {
        this.level = level;
    }


}
